package com.imooc.coupon.dao;

import com.imooc.coupon.entity.CouponTemplate;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @description: CouponTemplate Dao 接口定义
 * @author：naxiaozi，微信：naxiaozi
 * @date: 2025/8/14
 * @Copyright：
 */
public interface CouponTemplateDao extends JpaRepository<CouponTemplate,Integer> {
    /**
     * 根据名称查询模板
     * @param name
     * @return
     */
    CouponTemplate findByName(String name);

    /**
     * 根据 avaliable和expired查找记录
     * @param avaliable
     * @param expired
     * @return
     * where avaliable=? and expired=?
     */

    List<CouponTemplate> findAllByAvailableAndAndExpired(Boolean avaliable,Boolean expired);

    /**
     * 根据expired查找模板记录
     * where expired = ?
     * @param expired
     * @return
     */
    List<CouponTemplate> findAllByExpired(Boolean expired);
}
